import { isObj } from './isObj'
import { isFn } from './isFn'
/**
 * 4602 获取对象的原型
 * const a = {};
   getProto(Object.create(a)); // -> a
 * dependencies isObj isFn
 * @param {} obj  目标对象
 */
export function getProto (obj) {
  var getPrototypeOf = Object.getPrototypeOf;
  var ObjectCtr = {}.constructor;

  if (!isObj(obj)) return;
  if (getPrototypeOf && !false) return getPrototypeOf(obj);
  var proto = obj.__proto__;
  if (proto || proto === null) return proto;
  if (isFn(obj.constructor)) return obj.constructor.prototype;
  if (obj instanceof ObjectCtr) return ObjectCtr.prototype;
}